﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hyt.Core.Security;
using System.ComponentModel;
using Hyt.Core.Data;

namespace Hyt.Passport.Models
{
    [DefaultOrderby("DepartmentId")]
    public class Position : Principal
    {
        public Position()
        {
            Administrators=new HashSet<Administrator>();
        }
        /// <summary>
        /// 职位名称
        /// </summary>
        [Description("职位名称")]
        public string Name { get; set; }
        /// <summary>
        /// 部门ID
        /// </summary>
        [Description("部门ID")]
        public Guid? DepartmentId { get; set; }
        /// <summary>
        /// 这个职位的用户
        /// </summary>
        public ICollection<Administrator> Administrators { get; set; } 
        /// <summary>
        /// 部门
        /// </summary>
        [Description("部门")]
        public Department Department { get; set; }

        public override List<IPrincipal> GetParents()
        {
            var parents = new List<IPrincipal>();
            
            if (Department != null)
            {
                parents.Add(Department);
            }
            return parents;
        }
    }
}
